<template>
    <div>
        <router-link to="/EngineeringReplacementTeam" style="float: right">
            <el-button type="danger" icon="close" size="mini" class="bolder outsideBtnBS"></el-button>
        </router-link>
        <div class="block" style="margin-bottom: 10px">
            <span class="wrapper">
            </span>
        </div>
        <el-form :inline="true" :model="formInline" ref="formInline" style="border-bottom:1px solid #ccc;">
            <!--备件小类-->
            <el-form-item :label="nowLangue.spareSmallClass" class="selectMB10">
                <el-input disabled v-model="formInline.categoryName" size="mini"></el-input>
            </el-form-item>
            <!--工程替换组编码-->
            <el-form-item :label="nowLangue.productReplaceGroupCode" class="selectMB10">
                <el-input disabled v-model="formInline.code" size="mini"></el-input>
            </el-form-item>
            <!--工程替换组名称-->
            <el-form-item :label="nowLangue.productReplaceGroupName" class="selectMB10">
                <el-input disabled v-model="formInline.name" size="mini"></el-input>
            </el-form-item>
        </el-form>
        <label class="default-label" v-text="nowLangue.productReplaceGroupParm"><!--工程替换组参数：--></label>
        <el-table max-height="190" :data="engReplaceData" border style="width: 100%;">
            <!--序-->
            <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
            <!--参数名-->
            <el-table-column prop="name" :label="nowLangue.parmName"  header-align="center" show-overflow-tooltip> </el-table-column>
            <!--参数值-->
            <el-table-column prop="value" :label="nowLangue.parmValue"   header-align="center" show-overflow-tooltip></el-table-column>
            <!--参数单位-->
            <el-table-column prop="unit" :label="nowLangue.parmUnit" header-align="center" show-overflow-tooltip></el-table-column>
        </el-table>
        <label class="default-label" v-text="nowLangue.spareDetail"><!--备件明细：--></label>
        <el-table max-height="190" :data="spareData" border style="width: 100%;">
            <!--序-->
            <el-table-column type="index" header-align="center" align="center" :label="nowLangue.sequence" width="40"></el-table-column>
            <!--备件编码-->
            <el-table-column prop="materialCode" :label="nowLangue.spareCode" header-align="center" show-overflow-tooltip></el-table-column>
            <!--备件名称-->
            <el-table-column prop="materialName" :label="nowLangue.spareName" header-align="center" show-overflow-tooltip></el-table-column>
            <!--参数单位-->
            <el-table-column prop="" :label="nowLangue.parmUnit" header-align="center" show-overflow-tooltip></el-table-column>
        </el-table>
    </div>

</template>
<script>
    export default {
        data() {
            return {
                language:{
                    zh:{
                        "save":"保存",
                        "confirm":"确定",
                        "productReplaceGroupCode":"工程替换组编码",
                        "productReplaceGroupName":"工程替换组名称",
                        "productReplaceGroupParm":"工程替换组参数",
                        "spareSmallClass":"备件小类",
                        "pleaseSelect":"请选择",
                        "pleaseImport":"请输入",
                        "creator":"创建人",
                        "createTime":"创建时间",
                        "parmName":"参数名",
                        "parmValue":"参数值",
                        "parmUnit":"参数单位",
                        "spareDetail":"备件明细",
                        "addSpare":"添加备件",
                        "delete":"删除",
                        "spareCode":"备件编码",
                        "spareName":"备件名称",
                        "select":"选择",
                        "isLoading":"正在拼命加载中",
                        "query":"查询",
                        "sequence":"序",
                        "operate":"操作"
                    },
                    en:{
                        "save":"save",
                        "confirm":"confirm",
                        "productReplaceGroupCode":"productReplaceGroupCode",
                        "productReplaceGroupName":"productReplaceGroupName",
                        "productReplaceGroupParm":"productReplaceGroupParm",
                        "spareSmallClass":"spareSmallClass",
                        "pleaseSelect":"pleaseSelect",
                        "pleaseImport":"pleaseImport",
                        "creator":"creator",
                        "createTime":"createTime",
                        "parmName":"parmName",
                        "parmValue":"parmValue",
                        "parmUnit":"parmUnit",
                        "spareDetail":"spareDetail",
                        "addSpare":"addSpare",
                        "delete":"delete",
                        "spareCode":"spareCode",
                        "spareName":"spareName",
                        "select":"select",
                        "isLoading":"isLoading",
                        "query":"query",
                        "sequence":"sequence",
                        "operate":"operate"
                    }
                },
                nowLangue:{},
                id:"",//接受参数
                // 查询表单
                formInline:{},
                engReplaceData:[],
                spareData:[],
            };
        },
        created:function(){
            var _this=this;
            _this.languageType=="zh"?_this.nowLangue=_this.language.zh:_this.nowLangue=_this.language.en;
        },
        computed:{
            languageType(){
                return this.$store.state.languageType;
            }
        },
        watch:{
            languageType(){
                var _this=this;
                _this.languageType=="zh"?_this.nowLangue=_this.language.zh:_this.nowLangue=_this.language.en;
            }
        },
        //进入页面立即运行此方法
        mounted: function () {
            var _this = this;
            _this.$store.commit('currentActive', 'SeeEReplacementTeam');
            //ajax前后查询按钮禁用
            $(".selectAll").ajaxStart(function(){
                _this.selectDisabled=true;
            });
            $(".selectAll").ajaxStop(function(){
                _this.selectDisabled=false;
            });
            this.id=this.$route.query.id;
            this.queryInfor();
        },
        methods:{
            //查询
            queryInfor(){
                var _this=this;
                $.ajax({
                    type: 'GET',
                    url: _this.metadata_service+"substituteGroup/see?id="+_this.id,
                    cache: false,
                    dataType:'JSON',
                    contentType: "application/json;charset=utf-8",
                    success: function (data) {
                        if (data.success) {
                            _this.formInline=data.data;
                            _this.engReplaceData=data.data.projectsstClusterPropertySeeVoList;
                            _this.spareData=data.data.projectsstClusterMaterialList;
                        }else{
                            _this.common.errorTip(data.errorMessage);
                        }
                    }
                });
            },
        }
    }
</script>